package com.example.pubsearch;

import com.example.pubsearch.db.MySQLiteHelper;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Toast;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
	}

	@Override
	protected void onStart() {

		super.onStart();

		// handle the following part if you want to get complete initial data
		// setup:
		// ----------------------------------------------------------------------------

		MySQLiteHelper dbHelper = new MySQLiteHelper(this);
		if (dbHelper.getPubsCount() == 0) {
			// dbHelper.deletePubs();
			dbHelper.insertPubs();
		}
		// dbHelper.deletePubs();

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	public void startSearch(View v) {
		Toast t = Toast.makeText(this, "Search by pub name - page in progress",
				Toast.LENGTH_LONG);
		t.show();
		Intent myIntent = new Intent(this, SearchActivity.class);
		startActivity(myIntent);
	}

	public void startSearchGeo(View v) {
		Toast t = Toast.makeText(this, "Search GEO - page in progress",
				Toast.LENGTH_LONG);
		t.show();
		Intent myIntent = new Intent(this, SearchgeoActivity.class);
		startActivity(myIntent);
	}

}
